<?php
namespace PsiFramework\Classes\Util\Database\Query;

import("Classes.Util.Database.Query.SqlColumn");

use \PsiFramework\Classes\Util\Database\Query\SqlColumn;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * The SqlOrder class allows to specify the column
 * and in which order (ASC or DESC) the data must
 * be retrieved
 *
 * @package classes.util.xpersist.sql
 */
class SqlOrder
{

    /**
     * @var the "ASC" operator
     */
    public static $asc = "ASC" ;
    /**
     * @var the "DESC" operator
     */
    public static $desc = "DESC" ;

    protected /*SqlParameter*/ $_column ;
    protected /*string*/       $_order ;

    /**
     * SqlOrder constrcutor
     *
     * @param $column    the SqlParameter
     * @param $order    the order
     */
    public function __construct(SqlParameter $column, /*string*/ $order=null)
    {
        $this->_column = $column ;
        if ($order != null) {
            $this->_order = $order ;
        } else {
            $this->_order = self::$asc ;
        }
    }

    /**
     * Setter for the member variable $column
     *
     * @param $column
     */
    public function setColumn(SqlParameter $column)
    {
        $this->_column = $column ;
    }

    /**
     * Setter for the member variable $order
     *
     * @param $order
     */
    public function setOrder(/*string*/ $order)
    {
        $this->_order = $order ;
    }

    /**
     * Getter for the member variable $column
     *
     * @return SqlParameter
     */
    public function getColumn()
    {
        return $this->_column ;
    }

    /**
     * Getter for the member variable $order
     *
     * @return string
     */
    public function getOrder()
    {
        return $this->_order ;
    }

}

